Skip to content

Notifications: link noticeable records to viewable pages with friendly names#1663

Merged
maebeale merged 2 commits into
mainfrom
maebeale/notification-form-submission-route
Jun 13, 2026
Merged

Notifications: link noticeable records to viewable pages with friendly names#1663
maebeale merged 2 commits into
mainfrom
maebeale/notification-form-submission-route

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • The notifications Record column (index) and Noticeable field (detail page) previously linked using the raw model class name and polymorphic_path, which:
    • Crashed on the detail page for FormSubmission noticeables (bulk payments) — they have no polymorphic route, so polymorphic_path raised.
    • Showed an unhelpful label (EventRegistration, FormSubmission) that said nothing about which record it was.
  • This makes notification records traceable to the actual person/event/form they're about, and viewable from both the list and the detail page.

How did you approach the change?

  • Detail page routing — reused the existing routable_path helper (added by Notifications index: link form submission noticeables to a viewable page #1656 for the index) on show.html.erb so it links the same viewable destinations and degrades to plain text for routeless records, instead of calling polymorphic_path unconditionally.
  • Friendly labels — added two helpers:
    • noticeable_label — the record's name (registrant · event, submitter · form, or the record's own title/name).
    • noticeable_type_label — plain-language type (Registration, Bulk payment, Form submission, else humanized model name).
  • Format decision — rendered as a small uppercase type label over a text link (mirroring the existing People column), rather than a button, so it doesn't compete with the row's existing View action button.
  • Bulk payments — no dedicated handling needed: Notifications index: link form submission noticeables to a viewable page #1656's form_submission_path + shared _submission partial already render bulk-payment submissions (including the attendee table); they route there automatically.

UI Testing Checklist

  • Notifications index: Record column shows a type label + record name, links to the right page
  • Notification detail page: Noticeable field links correctly (no crash) for a bulk-payment notification
  • Routeless noticeables fall back to plain text (no link, no error)

Anything else to add?

  • Helper specs cover both new label helpers across registration / bulk payment / submission / other model cases.
  • Tests: helper specs 56/56, notifications request specs 28/28, lint clean.

🤖 Generated with Claude Code

maebeale and others added 2 commits June 13, 2026 17:17
PR #1656 fixed the notifications index but left the detail page calling
polymorphic_path unconditionally, which raises for FormSubmission noticeables
(bulk payments) that have no polymorphic route. Reuse the routable_path helper
so the detail page links the same viewable destinations and degrades to plain
text for routeless records.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Record/Noticeable links rendered the raw model class ("EventRegistration",
"FormSubmission"), which says nothing about which record it is. Add
noticeable_label (registrant · event, submitter · form, or the record's own
name) and noticeable_type_label ("Registration", "Bulk payment", "Form
submission"). Render as a small type label over a text link rather than a button
so it mirrors the People column and doesn't compete with the row's View action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@maebeale maebeale marked this pull request as ready for review June 13, 2026 21:59
<%= link_to @notification.noticeable.class.name,
polymorphic_path(@notification.noticeable),
class: "text-blue-600 hover:underline" %>
<% record_path = routable_path(@notification.noticeable) %>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: This is the actual bug fix — #1656 only updated the index, leaving the detail page calling polymorphic_path unconditionally, which raised for FormSubmission noticeables (bulk payments). Reusing routable_path here makes it consistent and crash-safe.

record.class.name.underscore.humanize
end

# A human-friendly name for a noticeable record (the registrant and event for a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: noticeable_label special-cases registrations/submissions (registrant · event, submitter · form) and otherwise falls back through title/name/full_name, so any future noticeable type gets a sensible label without changes here.

@maebeale maebeale merged commit 1acae96 into main Jun 13, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/notification-form-submission-route branch June 13, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant